# Contributor: Michael Jeanson <mjeanson@efficios.com>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=lttng-tools
pkgver=2.13.11
pkgrel=1
pkgdesc="LTTng 2.0 control and utility programs"
url="https://lttng.org"
arch="all"
license="GPL-2.0-only AND LGPL-2.1-only"
depends="babeltrace"
depends_dev="
	kmod-dev
	libxml2-dev
	lttng-ust-dev
	popt-dev
	userspace-rcu-dev
	util-linux-dev
	"
makedepends="$depends_dev autoconf automake bash coreutils grep libtool"
checkdepends="util-linux"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc"
source="https://lttng.org/files/lttng-tools/lttng-tools-$pkgver.tar.bz2
	test.patch
	remove-usage-of-off64_t.patch
	s390x-tests.patch.noauto
	"

prepare() {
	default_prepare
	case "$CARCH" in
	s390x)
		# patch out failing test for s390x, upstream investigating
		patch -p1 -i "$srcdir"/s390x-tests.patch.noauto
		# We patch Makefile.am
		autoreconf -fi
		;;
	esac
}
build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var
	make
}

check() {
	# only run unit tests. all tests takes too much time
	make -j1 -C tests/unit check
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
d758546100413138dc0713fc43c1bb9ea0ab6cc8285d924c83dbd23ba80d5aa560203e5ace360e5920158889a845a141fbffdf1d018b506c6b3607d0c339c0c2  lttng-tools-2.13.11.tar.bz2
1f4d0591b55955a698fe9767c8ce2676a25abdd6e2fb2d7addea8e23cf332c32631ca3d86bb2d1b0239cad972eb649418284ff12f36993373a15a9578dc52401  test.patch
79cfe2235f6758bbd770a83645d9eab92f9c7fc244147c64e4e965d28ff5bbeef534dc65dad079dcca1c4e5260d004b5a370ff92ad457b45337be3f22d1cdb77  remove-usage-of-off64_t.patch
d1e8d1d6f9abfb165acb181772b3eaf3f6e3caed5a7088e24b40a17eac6109bc92e485f77a2fc65c15f16e482a7d650d5f25c04b58073df47feb84e1855d650a  s390x-tests.patch.noauto
"
